#ifndef __DPS_ACTION_H__
#define __DPS_ACTION_H__
#include "dps_api.h"

#if 0
#define DPS_ACTION_MASK	0xf0
#define DPS_ACTION_MASK_	0X0F

#define DPS_ACTION_Idle	0x00

#define DPS_ACTION_Err	0x70
#define DPS_ACTION_Err_ResponseXMLStruct	0x71	//xml structure err
#define DPS_ACTION_Err_ResponseResult		0x72	//response the value of result is not OK(0x10000000)
#define DPS_ACTION_Err_Notify	0x73	//notify xml structure err

#define DPS_ACTION_START DPS_ACTION_ConfigurePrintService
#define DPS_ACTION_END	(DPS_ACTION_Response-1)

#define DPS_ACTION_ConfigurePrintService 0x10

#define DPS_ACTION_GetCapability 0x20
#define DPS_ACTION_GetCapability_Qualities	0x20
#define DPS_ACTION_GetCapability_PaperSizes	0x21
#define DPS_ACTION_GetCapability_PaperTypes	0x22 
#define DPS_ACTION_GetCapability_FileTypes	0x23
#define DPS_ACTION_GetCapability_DatePrints	0x24
#define DPS_ACTION_GetCapability_FileNamePrints	0x25
#define DPS_ACTION_GetCapability_ImageOptimizes	0x26
#define DPS_ACTION_GetCapability_Layouts	0x27
#define DPS_ACTION_GetCapability_FixedSizes	0x28
#define DPS_ACTION_GetCapability_Croppings	0x29

#define DPS_ACTION_StartJob 0x30
#define DPS_ACTION_AbortJob 0x3a
#define DPS_ACTION_ContinueJob 0x3b

#define DPS_ACTION_GetDeviceStatus 0x40
#define DPS_ACTION_GetJobStatus 0x41

#define DPS_ACTION_Response	0x50
#define DPS_ACTION_Response_NotifyStatusJob		0x51
#define DPS_ACTION_Response_NotifyStatusDevice		0x52

#define dps_checkIsAction_GetCapability(action)	((action & DPS_ACTION_MASK)==DPS_ACTION_GetCapability)
#endif
//g_dpsLastNotResponseAction
#if 0
extern UINT8 g_dpsLastNotResponseAction;
#define dps_checkDoActionEnable()				(g_dpsLastNotResponseAction == DPS_ACTION_Idle)
//#define dps_checkStartJobEnable() 		dps_checkActionEnable()
#define dps_checkConfigurePrintServiceEnable() 	((dps_checkDoActionEnable()))
#define dps_checkGetCapabilityEnable() 			((dps_checkDoActionEnable()))
#define dps_checkStartJobEnable() 				((dps_checkDoActionEnable()))
#define dps_checkAbortJobEnable() 		1//((dps_checkDoActionEnable())&&((g_dpsLastNotResponseAction == DPS_ACTION_StartJob)||(g_dpsLastNotResponseAction == DPS_ACTION_ContinueJob)))						
#define dps_checkContinueJobEnable() 	1//((dps_checkDoActionEnable())&&(g_dpsLastNotResponseAction == DPS_ACTION_AbortJob))
#define dps_checkGetDeviceStatusEnable() 		((dps_checkDoActionEnable()))
#define dps_checkGetJobStatusEnable() 			((dps_checkDoActionEnable()))

#define dps_checkIsGetCapabilityAction(action) 	((action & 0xf0) ==DPS_ACTION_GetCapability)
#define dps_checkIsAction(action)					((action>=DPS_ACTION_ConfigurePrintService)&&(action<=DPS_ACTION_GetJobStatus))
#define dps_checkIsIdleAction()					(g_dpsLastNotResponseAction == DPS_ACTION_Idle)
#define dps_changeAction(action)					g_dpsLastNotResponseAction = (action==g_dpsLastNotResponseAction)?DPS_ACTION_Idle:action

#define dps_clearLastNotResponseAction()			g_dpsLastNotResponseAction = DPS_ACTION_Idle
#define dps_setLastNotResponseAction(action)		g_dpsLastNotResponseAction=action
#define dps_getLastNotResponseAction()			g_dpsLastNotResponseAction
#endif

/////////////////////////////////////////
//g_dpsDataStatus
extern UINT16 g_dpsDataStatus;

#define DPS_DATA_Capability_Qualities	0x0001
#define DPS_DATA_Capability_PaperSizes	0x0002
#define DPS_DATA_Capability_PaperTypes	0x0004 
#define DPS_DATA_Capability_FileTypes	0x0008
#define DPS_DATA_Capability_DatePrints	0x0010
#define DPS_DATA_Capability_FileNamePrints	0x0020
#define DPS_DATA_Capability_ImageOptimizes	0x0040
#define DPS_DATA_Capability_Layouts			0x0080
#define DPS_DATA_Capability_FixedSizes		0x0100
#define DPS_DATA_Capability_Croppings		0x0200

#define DPS_DATA_ConfigurePrintService	0x1000
#define DPS_DATA_JobStatus				0x2000
#define DPS_DATA_DeviceStatus			0x4000

#define dps_transformActionToDataStatus_Capability(action) 		(0x0001<<(action - DPS_ACTION_GetCapability))
#define dps_checkIsNew_Capability(action)			(g_dpsDataStatus & dps_transformActionToDataStatus_Capability(action))

#define dps_checkIsNew_Qualites()					(g_dpsDataStatus & DPS_DATA_Capability_Qualities)
#define dps_checkIsNew_PaperSizes()					(g_dpsDataStatus & DPS_DATA_Capability_PaperSizes)
#define dps_checkIsNew_PaperTypes()				(g_dpsDataStatus & DPS_DATA_Capability_PaperTypes)
#define dps_checkIsNew_FileTypes()					(g_dpsDataStatus & DPS_DATA_Capability_FileTypes)
#define dps_checkIsNew_DatePrints()					(g_dpsDataStatus & DPS_DATA_Capability_DatePrints)
#define dps_checkIsNew_FileNamePrints()				(g_dpsDataStatus & DPS_DATA_Capability_FileNamePrints)
#define dps_checkIsNew_ImageOptimizes()			(g_dpsDataStatus & DPS_DATA_Capability_ImageOptimizes)
#define dps_checkIsNew_Layouts()					(g_dpsDataStatus & DPS_DATA_Capability_Layouts)
#define dps_checkIsNew_FixedSizes()					(g_dpsDataStatus & DPS_DATA_Capability_FixedSizes)
#define dps_checkIsNew_Croppings()					(g_dpsDataStatus & DPS_DATA_Capability_Croppings)

#define dps_checkIsNew_ConfigurePrintService()		(g_dpsDataStatus & DPS_DATA_ConfigurePrintService)
#define dps_checkIsNew_JobStatus()					(g_dpsDataStatus & DPS_DATA_JobStatus)
#define dps_checkIsNew_DeviceStatus()				(g_dpsDataStatus & DPS_DATA_DeviceStatus)

#define dps_addNewFag_Capability(action)				g_dpsDataStatus |= dps_transformActionToDataStatus_Capability(action)

#define dps_addNewFlag_Qualites()					g_dpsDataStatus |= DPS_DATA_Capability_Qualities
#define dps_addNewFlag_PaperSizes()					g_dpsDataStatus |= DPS_DATA_Capability_PaperSizes
#define dps_addNewFlag_PaperTypes()				g_dpsDataStatus |= DPS_DATA_Capability_PaperTypes
#define dps_addNewFlag_FileTypes()					g_dpsDataStatus |= DPS_DATA_Capability_FileTypes
#define dps_addNewFlag_DatePrints()					g_dpsDataStatus |= DPS_DATA_Capability_DatePrints
#define dps_addNewFlag_FileNamePrints()				g_dpsDataStatus |= DPS_DATA_Capability_FileNamePrints
#define dps_addNewFlag_ImageOptimizes()			g_dpsDataStatus |= DPS_DATA_Capability_ImageOptimizes
#define dps_addNewFlag_Layouts()					g_dpsDataStatus |= DPS_DATA_Capability_Layouts
#define dps_addNewFlag_FixedSizes()					g_dpsDataStatus |= DPS_DATA_Capability_FixedSizes
#define dps_addNewFlag_Croppings()					g_dpsDataStatus |= DPS_DATA_Capability_Croppings

#define dps_addNewFlag_ConfigurePrintService()		g_dpsDataStatus |= DPS_DATA_ConfigurePrintService
#define dps_addNewFlag_JobStatus()					g_dpsDataStatus |= DPS_DATA_JobStatus
#define dps_addNewFlag_DeviceStatus()				g_dpsDataStatus |= DPS_DATA_DeviceStatus

#define dps_removeNewFag_Capability(action)			g_dpsDataStatus &= ~(dps_transformActionToDataStatus_Capability(action))

#define dps_removeNewFlag_Qualites()				g_dpsDataStatus &= ~DPS_DATA_Capability_Qualities
#define dps_removeNewFlag_PaperSizes()				g_dpsDataStatus &= ~DPS_DATA_Capability_PaperSizes
#define dps_removeNewFlag_PaperTypes()				g_dpsDataStatus &= ~DPS_DATA_Capability_PaperTypes
#define dps_removeNewFlag_FileTypes()				g_dpsDataStatus &= ~DPS_DATA_Capability_FileTypes
#define dps_removeNewFlag_DatePrints()				g_dpsDataStatus &= ~DPS_DATA_Capability_DatePrints
#define dps_removeNewFlag_FileNamePrints()			g_dpsDataStatus |= DPS_DATA_Capability_FileNamePrints
#define dps_removeNewFlag_ImageOptimizes()		g_dpsDataStatus &= ~DPS_DATA_Capability_ImageOptimizes
#define dps_removeNewFlag_Layouts()				g_dpsDataStatus &= ~DPS_DATA_Capability_Layouts
#define dps_removeNewFlag_FixedSizes()				g_dpsDataStatus &= ~DPS_DATA_Capability_FixedSizes
#define dps_removeNewFlag_Croppings()				g_dpsDataStatus &= ~DPS_DATA_Capability_Croppings

#define dps_removeNewFlag_ConfigurePrintService()	g_dpsDataStatus &= ~DPS_DATA_ConfigurePrintService
#define dps_removeNewFlag_JobStatus()				g_dpsDataStatus &= ~DPS_DATA_JobStatus
#define dps_removeNewFlag_DeviceStatus()			g_dpsDataStatus &= ~DPS_DATA_DeviceStatus


/////////////////////////////
//action
UINT8 dps_actionConfigurePrintService();
UINT8 dps_actionGetCapability(UINT8 capabilityType,UINT32 param);
UINT8 dps_actionStartJob();
UINT8 dps_actionAbortJob(UINT32 param);
UINT8 dps_actionContinueJob();
UINT8 dps_actionGetDeviceStatus();
UINT8 dps_actionGetJobStatus();
UINT8 dps_actionResponse(UINT8 xdata*pData, UINT8 treeType);
void  dps_action(UINT8 xdata*pData, UINT8 treeType);
#endif
